package com.lengyue.imakiba.base;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jfinal.handler.Handler;

public class ContextPathHandler extends Handler {

	@Override
	public void handle(String target, HttpServletRequest request,
			HttpServletResponse response, boolean[] isHandled) {
		//为freemarker设置应用路径，在引用的第一个模板的<head>中加入<base href="${CONTEXT_PATH}/" />
		request.setAttribute("CONTEXT_PATH", request.getContextPath());
		nextHandler.handle(target, request, response, isHandled);
	}

}
